from pms.common.views import PostFormula
from technology.utils.create import create_technology


class API(PostFormula):

    require_permissions = [9]

    def handle(self, req):
        name = req['name']
        detail = req.get('detail', '')
        tech_id, tech_name, tech_detail = create_technology(name, detail)
        return self.success_respond({
            'id': tech_id,
            'name': tech_name,
            'detail': tech_detail
        })
